#include<stdio.h>

	int search(int arr[], int left, int right, int sum)
	{
		int mid = 0;
		while (left <= right)
		{
			mid = (left + right)>>1;
			if (arr[mid] < sum)
				left = mid + 1;
			else if (arr[mid] > sum)
				right = mid - 1;
			else
				return mid;
		}
	}
	int main()
	{
		int arr[] = { 0,1,2,3,4,5,6,7,8,9 };
		int left = 0;
		int right = sizeof(arr) / sizeof(arr[0]) - 1;
		int sum = 5;
		int s ;
		s=search(arr,left,right,sum);
		printf("%d", s);
		return 0;
	}






